var toastNum = 2
var pageData = {}
pageData.data = {}
for (var i = 0; i <= toastNum; ++i) {
  pageData.data['toast' + i + 'Hidden'] = true
    ; (function (index) {
      pageData['toast' + index + 'Change'] = function (e) {
        console.log(1,e)
        var obj = {}
        obj['toast' + index + 'Hidden'] = true
        this.setData(obj)
      }
      pageData['toast' + index + 'Tap'] = function (e) {
        var obj = {}
        obj['toast' + index + 'Hidden'] = false
        this.setData(obj)
      }
    })(i)
}
Page(pageData)